/*
 * @Descripttion:
 * @version:
 * @Author: 麦冬果果
 * @Date: 2021-03-26 16:28:28
 * @LastEditors: 麦冬果果
 * @LastEditTime: 2021-04-08 20:37:52
 */
package router

import (
	"mdgg/app/admin/api"
	"mdgg/app/admin/hook"
	middlewares "mdgg/app/admin/middleware"

	"github.com/gogf/gf/frame/g"
	"github.com/gogf/gf/net/ghttp"
)

//后端路由处理
func init() {
	s := g.Server()
	group := s.Group("/")

	group.Group("/captcha", func(group *ghttp.RouterGroup) {
		group.ALL("/get", new(api.Captcha))
	})

	group.Group("/system", func(group *ghttp.RouterGroup) {

		group.Middleware(middlewares.Admin)

		group.Middleware(middlewares.Auth) //后台权限验证
		//后台操作日志记录
		group.Hook("/*", ghttp.HOOK_AFTER_OUTPUT, hook.OperationLog)

		//文件上传
		group.POST("/upload", new(api.Upload))

		//权限管理
		group.ALL("/auth", new(api.Auth))

		//后台首页
		group.ALL("/index", new(api.Index))

		//部门管理
		group.ALL("/dept", new(api.Dept))

		//个人中心
		group.ALL("/user", new(api.User))

		//岗位管理
		group.ALL("/post", new(api.Post))

		//配置管理
		group.Group("/config", func(group *ghttp.RouterGroup) {
			group.ALL("/dict", new(api.Dict))
			group.ALL("/params", new(api.Params))
			group.ALL("/webSet", new(api.WebSet))
		})
		//系统监控
		group.Group("/monitor", func(group *ghttp.RouterGroup) {
			group.ALL("/online", new(api.MonitorOnline))
			group.ALL("/job", new(api.MonitorJob))
			group.ALL("/server", new(api.MonitorServer))
			group.ALL("/operlog", new(api.MonitorOperationLog))
			group.ALL("/loginlog", new(api.MonitorLoginLog))
		})

	})
}
